﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Crm/crm.master" CodeFile="list.aspx.cs"
    Inherits="Crm_Channel_List" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
 
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cbody" runat="Server">
    <div class="nav" style="padding: 5px;">
        当前位置：<a style="color: #fff;" href="list.aspx">栏目列表</a> ＞<%=GetNavLink(fid)%></div>
    <div style="margin-bottom: 5px;">
        <asp:Button ID="btnAddNew" runat="server" Text="新建板块" OnClick="btnAddNew_Click" /></div>
    <asp:GridView ID="gvList" runat="server" AutoGenerateColumns="False" DataKeyNames="bid"
        DataSourceID="accessdata" AllowPaging="True" AllowSorting="false">
        <Columns>
            <asp:BoundField DataField="bid" HeaderText="编号" ReadOnly="True" SortExpression="bid"
                InsertVisible="False" />
            <asp:BoundField DataField="cname" HeaderText="板块名称" SortExpression="cname" />
            <asp:BoundField DataField="ename" HeaderText="英文名称" SortExpression="ename" />
            <asp:BoundField DataField="fid" HeaderText="父ID" SortExpression="fid" />
            <asp:BoundField DataField="linkto" HeaderText="链接地址" SortExpression="linkto" />
            <asp:BoundField DataField="linktohtml" HeaderText="静态地址" SortExpression="linktohtml" />
            <asp:BoundField DataField="page_title" HeaderText="页面标题" SortExpression="page_title" />
            <asp:CheckBoxField DataField="ismain" HeaderText="主板块" SortExpression="ismain" />
            <asp:CheckBoxField DataField="isshow" HeaderText="显示" SortExpression="isshow" />
            <asp:TemplateField ShowHeader="true" HeaderText="子分类">
                <ItemTemplate>
                    <a href="list.aspx?fid=<%#Eval("bid") %>">查看子分类</a>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:CommandField ShowEditButton="True" />
            <asp:TemplateField ShowHeader="False">
                <ItemTemplate>
                    <asp:LinkButton ID="LinkButton1" OnClientClick="return confirm('确认要删除吗？');" runat="server"
                        CausesValidation="False" CommandName="Delete" Text="删除"></asp:LinkButton>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField>
                <ItemTemplate>
                    <input type="button" class="btnup" value="升序" />
                    <input type="button" class="btndown" value="降序" />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="px" HeaderText="排序值" SortExpression="px" />
        </Columns>
    </asp:GridView>
    <asp:AccessDataSource ID="accessdata" runat="server" DataFile="~/App_Data/db.mdb"
        DeleteCommand="DELETE FROM [Channel] WHERE [bid] = ?" SelectCommand="SELECT [bid],[cname], [ename], [fid], xpath,[linkto],linktohtml, [px], [page_title], [isshow], [ismain]  FROM [Channel] where fid=@fid order by px"
        UpdateCommand="UPDATE [Channel] SET [cname] = ?, [ename] = ?, [fid] = ?, [linkto] = ?,[linktohtml] = ?, [px] = ?, [page_title] = ?, [isshow] = ?, [ismain] = ? WHERE [bid] = ?">
        <DeleteParameters>
            <asp:Parameter Name="bid" Type="Int32" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="cname" Type="String" />
            <asp:Parameter Name="ename" Type="String" />
            <asp:Parameter Name="fid" Type="Int32" />
            <asp:Parameter Name="linkto" Type="String" />
            <asp:Parameter Name="linktohtml" Type="String" />
            <asp:Parameter Name="px" Type="Int32" />
            <asp:Parameter Name="page_title" Type="String" />
            <asp:Parameter Name="isshow" Type="Boolean" />
            <asp:Parameter Name="ismain" Type="Boolean" />
            <asp:Parameter Name="bid" Type="Int32" />
        </UpdateParameters>
        <SelectParameters>
            <asp:QueryStringParameter Name="fid" Type="Int32" DefaultValue="0" QueryStringField="fid" />
        </SelectParameters>
    </asp:AccessDataSource>
</asp:Content>
